<?php

namespace App\Http\Controllers\Home;
use App\Http\Models\Article;
use App\Http\Models\Nav;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\View;

class CommonController extends Controller
{
    public function __construct()
    {
       $this->dataShare();
    }
    public function dataShare()
    {
        // 自定义导航
        $nav = Nav::orderBy('nav_order','asc')->get();
        // 最新文章
        $news = Article::orderBy('art_time','desc')->take(8)->get();
        // 点击排行 站长推荐
        $hot = Article::orderBy('art_view','desc')->take(6)->get();
        View::share('nav',$nav);
        View::share('news',$news);
        View::share('hot',$hot);

    }

}
